package cong.cheng.thread;

// 使用 sleep() 方法的示例
public class SleepExample {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            try {
                System.out.println("Thread started");
                Thread.sleep(1000); // 线程暂停1秒钟
                System.out.println("Thread resumed");
            } catch (InterruptedException e) {
                System.out.println("Thread interrupted");
            }
        });
        t.start();
        t.join(); // 等待线程执行完毕
    }
}